/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/

// 代码
function delay(time, data) {
  return new Promise((resolve) => {
      setTimeout(resolve, time, data)
  })
}

delay(10)
  .then(() => {
      var a = 'hello'
      return delay(10, a)
  })
  .then((res) => {
      var b = 'lagou'
      return delay(10, res + b)
  })
  .then((res) => {
      var c = 'I ❤ U'
      console.log(res + c)
  })